If there's an early error, part_temp_fds will be NULL and dereferencing
the len member will segfault.
Closes: #454
Closes: #448
Approved by: cgwalters
ret = TRUE;
out:
- for (i = 0; i < part_temp_fds->len; i++)
- {
- int fd = g_array_index (part_temp_fds, int, i);
- if (fd == -1)
- continue;
- (void) close (fd);
- }
+ if (part_temp_fds)
+ for (i = 0; i < part_temp_fds->len; i++)
+ {
+ int fd = g_array_index (part_temp_fds, int, i);
+ if (fd == -1)
+ continue;
+ (void) close (fd);
+ }
g_clear_pointer (&builder.parts, g_ptr_array_unref);
g_clear_pointer (&builder.fallback_objects, g_ptr_array_unref);
return ret;